package com.wnxy.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author yellow Docter
 * @date 2024-06-26
 * @desc 蜗牛创想：www.woniuxy.com
 *
 * restful
 *     1、所有的请求的路径一致
 *     2、添加 post
 *     2  删除 delete
 *     2、修改 put
 *     2、查询 get
 */
@Controller
public class UserController {

    /**
     *  @RequestMapping(value = "/user",method = RequestMethod.GET)
     *  请求的路径是  user
     *  请求的方法是  get
     *   http://localhost:8080/user
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/user",method = RequestMethod.POST)
    public String addUser(){
        return "post";
    }

    @ResponseBody
    @RequestMapping(value = "/user",method = RequestMethod.DELETE)
    public String delete(){
        return "delete";
    }

    @ResponseBody
    @RequestMapping(value = "/user",method = RequestMethod.PUT)
    public String update(){
        return "update";
    }

    @ResponseBody
    @RequestMapping(value = "/user",method = RequestMethod.GET)
    public String list(){
        return "list";
    }
}
